# 安装
 if [[ -z "$(docker images -q docker.io/xuxueli/xxl-job-admin:2.3.0 2> /dev/null)" ]]; then
    docker pull docker.io/xuxueli/xxl-job-admin:2.3.0
 else
    echo "xxl-job-admin installed"
  fi
#	运行  对应的数据库xxl_job要先存入
  if [[ -z "$(docker ps -aqf "name=xxl-job-pattern")" ]]; then
    mkdir -p /opt/xxl-job/logs
      chmod 777 /opt/xxl-job/logs
      docker run -e PARAMS="--spring.datasource.url=jdbc:mysql://project-pattern:3306/xxl_job?Unicode=true&characterEncoding=UTF-8 \
        --server.servlet.context-path=/xxl-job/ \
        --spring.datasource.username=root \
        --spring.datasource.password=p123456 \
        --spring.mail.host=smtp.qq.com \
        --spring.mail.port=25 \
        --spring.mail.username=xxxx@qq.com \
        --spring.mail.password=xxxx \
        --spring.mail.properties.mail.smtp.auth=true \
        --spring.mail.properties.mail.smtp.starttls.enable=true \
        --spring.mail.properties.mail.smtp.starttls.required=true \
        --spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory \
        --xxl.job.accessToken=1234567890olkjhhj" \
        -p 10002:8080 -v /opt/xxl-job/logs:/data/applogs \
        --add-host=project-pattern:192.168.0.101 \
        --name xxl-job-pattern --restart=always  -d docker.io/xuxueli/xxl-job-admin:2.3.0
  else
      echo "xxl-job-pattern running"
  fi

# 访问地址： http://localhost:10002/xxl-job-admin/